package com.ggh.jinjilive.ui.mine;

import android.os.Bundle;
import android.text.TextUtils;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.blankj.utilcode.util.BarUtils;
import com.ggh.jinjilive.R;
import com.ggh.jinjilive.databinding.ActivityMineInviteBinding;
import com.ggh.jinjilive.listener.AddOnClickListener1;
import com.ggh.jinjilive.mobile.mine.zhubo.InvitationShareModel;
import com.ggh.jinjilive.ui.BaseActivity;
import com.ggh.jinjilive.utils.ARouterUtils;
import com.ggh.jinjilive.utils.GeneralUtils;
import com.gyf.immersionbar.ImmersionBar;


@Route(path = ARouterUtils.MineInviteActivity)
public class MineInviteActivity extends BaseActivity<ActivityMineInviteBinding> {

    @Override
    public void initCreate() {
        super.initCreate();
        ImmersionBar.with(this).keyboardEnable(true).init();
    }

    @Override
    public int initContentView(Bundle savedInstanceState) {
        return R.layout.activity_mine_invite;
    }

    @Override
    public void initView() {
        super.initView();
        setWhiteActionBarStyle("我的邀请",true,true);
        //获取状态栏高度
        binding.llSpacing.setPadding(0, BarUtils.getStatusBarHeight(),0,0);
    }

    @Override
    public void initData() {
        super.initData();
        //分享
        GeneralUtils.infoShare(new AddOnClickListener1() {
            @Override
            public void onSkipClicked(Object mObject) {
                InvitationShareModel invitationShareModel = (InvitationShareModel) mObject;
                if(null != invitationShareModel){
                    //我的上级
                    if(TextUtils.isEmpty(invitationShareModel.getPname())){
                        //我的上级
                        binding.invitationUpName.setText("去设置");
                    }else {
                        //我的上级
                        binding.invitationUpName.setText(invitationShareModel.getPname());
                        binding.llSuperior.setEnabled(false);
                    }
                    //下级总提成
                    binding.invitationDownMoney.setText(String.valueOf(invitationShareModel.getPid1_price()));
                    //下下级总提成
                    binding.invitationDownDown.setText(String.valueOf(invitationShareModel.getPid2_price()));
                    //您的邀请码
                    binding.tvInviteCode.setText(invitationShareModel.getLnvite_code());
                }
            }
        });
    }

    @Override
    public void initViewObservable() {
        super.initViewObservable();

    }
}
